package com.hiwan.unions.view.materialspinner;

/**
 * Created by llg on 2017/7/17.
 */

import android.content.Context;

import com.jaredrummler.materialspinner.MaterialSpinnerBaseAdapter;

import java.util.List;

public class MaterialSpinnerAdapter<T> extends MaterialSpinnerBaseAdapter {

    private final List<T> items;

    public MaterialSpinnerAdapter(Context context, List<T> items) {
        super(context);
        this.items = items;
    }

    @Override
    public int getCount() {
        return items.size();
    }

    @Override
    public T getItem(int position) {
//        if (position >= getSelectedIndex()) {
//            return items.get(position + 1);
//        } else {
        return items.get(position);
//        }
    }

    @Override
    public T get(int position) {
        return items.get(position);
    }

    @Override
    public List<T> getItems() {
        return items;
    }

}